<?php
include("./API.php");
include("../config.php");
tongji("qqgroup_active");
$skey="./data/".$Robot."/skey.php";
$skey=file_get_contents($skey);
$skey=json_decode($skey,true);
$uin=$_REQUEST['uin']?:$skey["uin"];//操作者qq
$skey=$_REQUEST['skey']?:$skey["skey"];//操作者skey
$qh=$_REQUEST["qh"];//操作群号
$pskey="./".$Robot."/pskey.php";
$pskey=file_get_contents($pskey);
preg_match_all('/qun.qq.com":"(.*?)"/',str_replace('\\','',$pskey),$p);
$p_skey=$_REQUEST['p_skey']?:$p[1][0];//操作者qq
$num=($_REQUEST["num"]?$_REQUEST["num"]:20)-1;//查询的月数(就是几个月以内的)
if($skey==null) {
	echo json(1001,"text","请输入SKEY！");
	exit();
} else if($p_skey==null) {
	echo json(1002,"text","请输入P_skey！");
	exit();
} else if($uin==null) {
	echo json(1003,"text","请输入操作者QQ！");
	exit();
} else if($qh==null) {
	echo json(1004,"text","请输入群号码！");
	exit();
}
$haeder=[
'Cookie: ptui_loginuin='.$uin.'; p_uin=o'.$uin.'; uin=o'.$uin.'; skey='.$skey.'; p_skey='.$p_skey.';',
];
$return=curl("https://qun.qq.com/cgi-bin/qun_mgr/search_group_members","gc=".$qh."&st=0&end=".$num."&sort=0&last_speak_time=2592000%7C7776000&bkn=".getBkn($skey),$haeder);
$data=json_decode($return,true);
if($data["ec"]==4) {
	echo json(1007,"text","Cookie已失效！");
	exit();
} else if($data["ec"]=="7") {
	echo json(1008,"text","无权操作！");
	exit();
} else if($data["ec"]=="-100005") {
	echo json(1009,"text","群号输入错误或目标QQ不存在！");
	exit();
} else if($data["ec"]=="0") {
foreach($data["mems"] as $k=>$v){
$array["data"][$k]=$v["uin"];
}
	echo json(1000,null,null,$array);
	exit();
} else {
	echo json(1010,"text","操作失败，错误码：".$data["ec"]);
	exit();
}

